package com.lagou.orm.config;

import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;

public class Configuration {

    private DataSource dataSource;

    /*
     *   key: statementid  value:封装好的mappedStatement对象
     * */
    Map<String, MappedStatement> mappedStatementMap = new HashMap<>();

    public DataSource getDataSource() {
        return dataSource;
    }

    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    public MappedStatement getStatement(String statementId) {
        return mappedStatementMap.get(statementId);
    }

    public int statementSize() {
        return mappedStatementMap.size();
    }

    public void addStatement(String statementId, MappedStatement statement) {
        mappedStatementMap.put(statementId, statement);
    }
}
